package edu.zut.cs.software.perfect.process.domain;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import edu.zut.cs.software.perfect.base.domain.BaseTreeEntity;

/**
 * @ClassName ProcessRegistrar
 * @Description TODO
 * @Author niu-xi
 * @Date 2020年5月29日 下午4:57:13
 * @Version 1.0
 */

@Entity
@Table(name = "T_PROCESS_REGISTRAR")
@NamedQueries({ @NamedQuery(name = "ProcessRegistrar.getRoot", query = "select m from ProcessRegistrar m where m.parent is null") })
public class ProcessRegistrar extends BaseTreeEntity<ProcessRegistrar,Long> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6352184481579972509L;

	/**
	 * classNumber for ProcessRegistrar
	 */
	@Column
	String courseNumber;
	
	/**
	 * className for ProcessRegistrar
	 */
	@Column
	String courseName;
	
	/**
	 * One ProcessRegistrar relate to many CourseProcess.
	 */
	@OneToMany(mappedBy="processRegistrar",cascade=CascadeType.REMOVE,fetch=FetchType.EAGER)
	List<CourseProcess> CourseProcesses;

	public String getCourseNumber() {
		return courseNumber;
	}

	public void setCourseNumber(String courseNumber) {
		this.courseNumber = courseNumber;
	}

	public String getCourseName() {
		return courseName;
	}

	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}

	public List<CourseProcess> getCourseProcesses() {
		return CourseProcesses;
	}

	public void setCourseProcesses(List<CourseProcess> courseProcesses) {
		CourseProcesses = courseProcesses;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	@Override
	public boolean equals(Object obj) {
		return EqualsBuilder.reflectionEquals(this, obj);
	}

	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
	}
	
	
	
}
